package com.example.demo.controller;

import com.example.demo.service.GoodsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;

@Controller
@RequestMapping("/goods")
public class GoodsController {

    @Autowired
    private GoodsService goodsService;

    @RequestMapping("/getGoodsList")
    @ResponseBody
    public List<Goods> getALLGoods(){
        List<Goods> goodsList = goodsService.getGoodsList();
        return goodsList;
    }

    @RequestMapping("/getListByName")
    @ResponseBody
    public List<Goods> getListByName(String name,int num){
        System.out.println(name+num);
        List<Goods> goodsList = goodsService.getGoodsListByName(name);
        return goodsList;
    }

    @RequestMapping("/getzhu")
    public String getZhu(){
       return "zhu";
    }

}
